package oo3;

public class People {
	String name, sex, zhiwu;
	private int age;
	double xinshui;
	String gonhao;

	public People() {
	}

	public People(String name, String sex, String zhiwu, int age, double xinshui, String gonhao) {
		super();
		this.name = name;
		this.sex = sex;
		this.zhiwu = zhiwu;
		// if (age < 14) {
		// System.out.println("年龄不对,改成22。");
		// age = 22;
		// }

		// this.age = age;
		setAge(age);

		this.xinshui = xinshui;
		this.gonhao = gonhao;
	}

	public String info() {
		String xinxi = "姓名：" + name + "，性别：" + sex + "，职务：" + zhiwu + "，薪水：" + xinshui + "，年龄：" + age + ",工号：" + gonhao;
		return xinxi;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		if (age < 14) {
			System.out.println("年龄不对,改成22。");
			age = 22;
		}
		this.age = age;
	}

}
